@malloy-publisher/sdk 0.0.382-dev → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (284) hide show
  1. package/README.md +115 -95
  2. package/TREE_SHAKING.md +16 -11
  3. package/bunfig.toml +7 -0
  4. package/dist/ServerProvider-Cn_LhKda.cjs.js +1 -0
  5. package/dist/ServerProvider-sfabtriY.es.js +4076 -0
  6. package/dist/client/api.d.ts +3773 -1515
  7. package/dist/client/configuration.d.ts +1 -1
  8. package/dist/client/index.cjs.js +1 -1
  9. package/dist/client/index.d.ts +1 -1
  10. package/dist/client/index.es.js +86 -59
  11. package/dist/components/Connections/EditConnectionDialog.d.ts +2 -1
  12. package/dist/components/Connections/common.d.ts +8 -2
  13. package/dist/components/Dashboard/Dashboard.d.ts +62 -0
  14. package/dist/components/Dashboard/DashboardTile.d.ts +57 -0
  15. package/dist/components/Dashboard/index.d.ts +2 -0
  16. package/dist/components/DataAppViewer/DataAppViewer.d.ts +23 -0
  17. package/dist/components/DataAppViewer/index.d.ts +1 -0
  18. package/dist/components/Environment/Environment.d.ts +6 -0
  19. package/dist/components/Environment/index.d.ts +2 -0
  20. package/dist/components/Home/AddEnvironmentDialog.d.ts +1 -0
  21. package/dist/components/Home/DeleteEnvironmentDialog.d.ts +5 -0
  22. package/dist/components/Home/EditEnvironmentDialog.d.ts +7 -0
  23. package/dist/components/Home/Home.d.ts +2 -2
  24. package/dist/components/Materializations/CreateEnvMaterializationDialog.d.ts +14 -0
  25. package/dist/components/Materializations/CreateMaterializationDialog.d.ts +10 -0
  26. package/dist/components/Materializations/DeleteMaterializationDialog.d.ts +7 -0
  27. package/dist/components/Materializations/EnvironmentMaterializations.d.ts +7 -0
  28. package/dist/components/Materializations/ManifestView.d.ts +13 -0
  29. package/dist/components/Materializations/MaterializationDetailDialog.d.ts +9 -0
  30. package/dist/components/Materializations/MaterializationRunsList.d.ts +15 -0
  31. package/dist/components/Materializations/Materializations.d.ts +7 -0
  32. package/dist/components/Materializations/ScheduleCard.d.ts +20 -0
  33. package/dist/components/Materializations/SectionLabel.d.ts +10 -0
  34. package/dist/components/Materializations/SetScheduleDialog.d.ts +11 -0
  35. package/dist/components/Materializations/TriggerChip.d.ts +10 -0
  36. package/dist/components/Materializations/cron.d.ts +23 -0
  37. package/dist/components/Materializations/index.d.ts +2 -0
  38. package/dist/components/Materializations/utils.d.ts +46 -0
  39. package/dist/components/Notebook/Notebook.d.ts +47 -4
  40. package/dist/components/Notebook/NotebookCell.d.ts +37 -1
  41. package/dist/components/Notebook/runPlan.d.ts +29 -0
  42. package/dist/components/Notebook/types.d.ts +10 -0
  43. package/dist/components/Package/ContentTypeIcon.d.ts +31 -0
  44. package/dist/components/Package/Package.d.ts +1 -4
  45. package/dist/components/RenderedResult/RenderedResult.d.ts +7 -1
  46. package/dist/components/RenderedResult/ResultContainer.d.ts +5 -1
  47. package/dist/components/RenderedResult/renderLogs.d.ts +6 -0
  48. package/dist/components/ResultsDialog.d.ts +6 -1
  49. package/dist/components/ServerProvider.d.ts +28 -4
  50. package/dist/components/click_helper.d.ts +10 -1
  51. package/dist/components/drill/index.d.ts +3 -0
  52. package/dist/components/drill/markDrillableCells.d.ts +55 -0
  53. package/dist/components/drill/resolveDrill.d.ts +139 -0
  54. package/dist/components/drill/useDrill.d.ts +63 -0
  55. package/dist/components/given/GivenInput.d.ts +52 -0
  56. package/dist/components/given/GivensPanel.d.ts +47 -0
  57. package/dist/components/given/filterValue.d.ts +97 -0
  58. package/dist/components/given/index.d.ts +2 -0
  59. package/dist/components/given/paramCodec.d.ts +60 -0
  60. package/dist/components/given/utils.d.ts +17 -0
  61. package/dist/components/highlighter.d.ts +6 -1
  62. package/dist/components/index.d.ts +7 -2
  63. package/dist/components/styles.d.ts +47 -0
  64. package/dist/constants/docLinks.d.ts +12 -0
  65. package/dist/{core-YNpOLuB1.cjs.js → core-CqRKhtoy.cjs.js} +1 -1
  66. package/dist/{core-CjeTkq8O.es.js → core-DyU47reh.es.js} +1 -1
  67. package/dist/github-dark-BKL9xNgN.cjs.js +1 -0
  68. package/dist/github-dark-DenFmJkN.es.js +4 -0
  69. package/dist/hooks/givenValue.d.ts +10 -0
  70. package/dist/hooks/index.d.ts +4 -0
  71. package/dist/hooks/useDimensionFiltersFromSpec.d.ts +3 -3
  72. package/dist/hooks/useDimensionFiltersQuery.d.ts +3 -3
  73. package/dist/hooks/useDimensionalFilterRangeData.d.ts +4 -4
  74. package/dist/hooks/useGivensState.d.ts +64 -0
  75. package/dist/hooks/useModelGivens.d.ts +10 -0
  76. package/dist/hooks/useSuggestOptions.d.ts +78 -0
  77. package/dist/{index-DRDu9kIV.es.js → index-CAkFE4Ol.es.js} +41278 -28504
  78. package/dist/index-DD4b_bt0.cjs.js +356 -0
  79. package/dist/index.cjs.js +1 -1
  80. package/dist/index.d.ts +4 -1
  81. package/dist/index.es.js +79 -48
  82. package/dist/malloy-explorer.css +12 -1
  83. package/dist/sdk.css +1 -1
  84. package/dist/theme/ThemeContext.d.ts +45 -0
  85. package/dist/theme/buildMalloyExplicitTheme.d.ts +34 -0
  86. package/dist/theme/buildTableCssVars.d.ts +41 -0
  87. package/dist/theme/buildVegaThemeOverride.d.ts +16 -0
  88. package/dist/theme/defaults.d.ts +7 -0
  89. package/dist/theme/index.d.ts +8 -0
  90. package/dist/theme/keys.d.ts +20 -0
  91. package/dist/theme/readChartAnnotations.d.ts +23 -0
  92. package/dist/theme/resolveTheme.d.ts +22 -0
  93. package/dist/theme/types.d.ts +70 -0
  94. package/dist/utils/dataAppEmbed.d.ts +44 -0
  95. package/dist/utils/formatting.d.ts +1 -1
  96. package/dist/utils/malloyString.d.ts +7 -0
  97. package/dist/utils/parsing.d.ts +2 -2
  98. package/dist/utils/queryClient.d.ts +5 -0
  99. package/package.json +19 -8
  100. package/src/client-entry.ts +3 -0
  101. package/src/components/AnalyzePackageButton.tsx +9 -3
  102. package/src/components/ApiErrorDisplay.tsx +3 -0
  103. package/src/components/Connections/AddConnectionDialog.tsx +132 -25
  104. package/src/components/Connections/DeleteConnectionDialog.tsx +14 -3
  105. package/src/components/Connections/EditConnectionDialog.tsx +167 -37
  106. package/src/components/Connections/common.ts +94 -3
  107. package/src/components/DOMElement/DOMElement.tsx +3 -0
  108. package/src/components/DOMElement/index.ts +3 -0
  109. package/src/components/Dashboard/Dashboard.spec.tsx +216 -0
  110. package/src/components/Dashboard/Dashboard.tsx +458 -0
  111. package/src/components/Dashboard/DashboardTile.spec.tsx +81 -0
  112. package/src/components/Dashboard/DashboardTile.tsx +199 -0
  113. package/src/components/Dashboard/index.ts +5 -0
  114. package/src/components/Dashboard/tileGridColumn.spec.ts +35 -0
  115. package/src/components/DataAppViewer/DataAppViewer.tsx +214 -0
  116. package/src/components/DataAppViewer/index.ts +4 -0
  117. package/src/components/{Project → Environment}/About.tsx +11 -4
  118. package/src/components/Environment/AddPackageDialog.tsx +202 -0
  119. package/src/components/{Project → Environment}/ConnectionExplorer.tsx +17 -14
  120. package/src/components/Environment/Connections.tsx +391 -0
  121. package/src/components/{Project → Environment}/DeletePackageDialog.tsx +8 -4
  122. package/src/components/{Project → Environment}/EditPackageDialog.tsx +21 -13
  123. package/src/components/Environment/Environment.tsx +89 -0
  124. package/src/components/Environment/Packages.tsx +206 -0
  125. package/src/components/Environment/index.ts +5 -0
  126. package/src/components/Home/{AddProjectDialog.tsx → AddEnvironmentDialog.tsx} +25 -19
  127. package/src/components/Home/{DeleteProjectDialog.tsx → DeleteEnvironmentDialog.tsx} +20 -15
  128. package/src/components/Home/{EditProjectDialog.tsx → EditEnvironmentDialog.tsx} +35 -28
  129. package/src/components/Home/Home.tsx +386 -408
  130. package/src/components/Home/index.ts +3 -0
  131. package/src/components/Loading.tsx +3 -0
  132. package/src/components/Materializations/CreateEnvMaterializationDialog.tsx +179 -0
  133. package/src/components/Materializations/CreateMaterializationDialog.tsx +112 -0
  134. package/src/components/Materializations/DeleteMaterializationDialog.tsx +109 -0
  135. package/src/components/Materializations/EnvironmentMaterializations.tsx +267 -0
  136. package/src/components/Materializations/ManifestView.tsx +87 -0
  137. package/src/components/Materializations/MaterializationDetailDialog.tsx +259 -0
  138. package/src/components/Materializations/MaterializationRunsList.tsx +256 -0
  139. package/src/components/Materializations/Materializations.tsx +355 -0
  140. package/src/components/Materializations/ScheduleCard.tsx +231 -0
  141. package/src/components/Materializations/SectionLabel.tsx +30 -0
  142. package/src/components/Materializations/SetScheduleDialog.tsx +162 -0
  143. package/src/components/Materializations/TriggerChip.tsx +44 -0
  144. package/src/components/Materializations/cron.ts +124 -0
  145. package/src/components/Materializations/index.ts +5 -0
  146. package/src/components/Materializations/utils.ts +145 -0
  147. package/src/components/Model/Model.tsx +44 -2
  148. package/src/components/Model/ModelCell.tsx +14 -5
  149. package/src/components/Model/ModelExplorer.tsx +3 -0
  150. package/src/components/Model/ModelExplorerDialog.tsx +4 -1
  151. package/src/components/Model/SourcesExplorer.tsx +9 -6
  152. package/src/components/Model/index.ts +3 -0
  153. package/src/components/Model/useModelData.ts +6 -3
  154. package/src/components/Notebook/Notebook.spec.tsx +88 -0
  155. package/src/components/Notebook/Notebook.tsx +476 -339
  156. package/src/components/Notebook/NotebookCell.tsx +264 -25
  157. package/src/components/Notebook/index.ts +3 -0
  158. package/src/components/Notebook/runPlan.spec.ts +155 -0
  159. package/src/components/Notebook/runPlan.ts +67 -0
  160. package/src/components/Notebook/types.ts +14 -0
  161. package/src/components/Package/ContentTypeIcon.spec.ts +91 -0
  162. package/src/components/Package/ContentTypeIcon.tsx +177 -0
  163. package/src/components/Package/FileTreeView.tsx +3 -0
  164. package/src/components/Package/Models.tsx +7 -4
  165. package/src/components/Package/Package.spec.tsx +113 -0
  166. package/src/components/Package/Package.tsx +692 -59
  167. package/src/components/Package/index.ts +3 -0
  168. package/src/components/QueryResult/QueryResult.tsx +17 -8
  169. package/src/components/QueryResult/index.ts +3 -0
  170. package/src/components/RenderedResult/RenderedResult.tsx +725 -67
  171. package/src/components/RenderedResult/ResultContainer.tsx +71 -2
  172. package/src/components/RenderedResult/index.ts +3 -0
  173. package/src/components/RenderedResult/renderLogs.spec.ts +58 -0
  174. package/src/components/RenderedResult/renderLogs.ts +43 -0
  175. package/src/components/ResultsDialog.tsx +13 -1
  176. package/src/components/ServerProvider.tsx +175 -51
  177. package/src/components/Workbook/BrowserWorkbookStorage.ts +3 -0
  178. package/src/components/Workbook/EditableMalloyCell.tsx +3 -0
  179. package/src/components/Workbook/ModelPicker.tsx +7 -4
  180. package/src/components/Workbook/MutableCell.tsx +10 -5
  181. package/src/components/Workbook/Workbook.tsx +8 -5
  182. package/src/components/Workbook/WorkbookList.tsx +3 -0
  183. package/src/components/Workbook/WorkbookManager.ts +3 -0
  184. package/src/components/Workbook/WorkbookStorage.ts +3 -0
  185. package/src/components/Workbook/WorkbookStorageProvider.tsx +3 -0
  186. package/src/components/Workbook/index.ts +3 -0
  187. package/src/components/click_helper.ts +17 -1
  188. package/src/components/drill/index.ts +28 -0
  189. package/src/components/drill/markDrillableCells.dom.spec.ts +313 -0
  190. package/src/components/drill/markDrillableCells.spec.ts +109 -0
  191. package/src/components/drill/markDrillableCells.ts +314 -0
  192. package/src/components/drill/resolveDrill.spec.ts +449 -0
  193. package/src/components/drill/resolveDrill.ts +375 -0
  194. package/src/components/drill/useDrill.tsx +203 -0
  195. package/src/components/filter/DimensionFilter.tsx +3 -0
  196. package/src/components/filter/index.ts +3 -0
  197. package/src/components/filter/utils.ts +16 -5
  198. package/src/components/given/GivenInput.spec.tsx +689 -0
  199. package/src/components/given/GivenInput.tsx +801 -0
  200. package/src/components/given/GivensPanel.spec.tsx +175 -0
  201. package/src/components/given/GivensPanel.tsx +195 -0
  202. package/src/components/given/filterValue.spec.ts +364 -0
  203. package/src/components/given/filterValue.ts +207 -0
  204. package/src/components/given/index.ts +9 -0
  205. package/src/components/given/paramCodec.spec.ts +857 -0
  206. package/src/components/given/paramCodec.ts +483 -0
  207. package/src/components/given/utils.spec.ts +60 -0
  208. package/src/components/given/utils.ts +79 -0
  209. package/src/components/highlighter.ts +22 -5
  210. package/src/components/index.ts +10 -2
  211. package/src/components/styles.ts +82 -33
  212. package/src/constants/docLinks.spec.ts +54 -0
  213. package/src/constants/docLinks.ts +46 -0
  214. package/src/hooks/givenValue.ts +13 -0
  215. package/src/hooks/index.ts +13 -0
  216. package/src/hooks/useDimensionFilters.ts +4 -7
  217. package/src/hooks/useDimensionFiltersFromSpec.ts +8 -5
  218. package/src/hooks/useDimensionFiltersQuery.ts +10 -13
  219. package/src/hooks/useDimensionalFilterRangeData.ts +11 -14
  220. package/src/hooks/useGivensState.spec.ts +449 -0
  221. package/src/hooks/useGivensState.ts +340 -0
  222. package/src/hooks/useModelGivens.ts +29 -0
  223. package/src/hooks/useQueryWithApiError.ts +3 -0
  224. package/src/hooks/useRawQueryData.ts +6 -3
  225. package/src/hooks/useSuggestOptions.dom.spec.ts +91 -0
  226. package/src/hooks/useSuggestOptions.spec.ts +112 -0
  227. package/src/hooks/useSuggestOptions.ts +268 -0
  228. package/src/index.ts +10 -1
  229. package/src/react-app-env.d.ts +3 -0
  230. package/src/theme/ThemeContext.tsx +86 -0
  231. package/src/theme/buildMalloyExplicitTheme.ts +61 -0
  232. package/src/theme/buildTableCssVars.spec.ts +86 -0
  233. package/src/theme/buildTableCssVars.ts +98 -0
  234. package/src/theme/buildVegaThemeOverride.spec.ts +56 -0
  235. package/src/theme/buildVegaThemeOverride.ts +47 -0
  236. package/src/theme/defaults.ts +78 -0
  237. package/src/theme/index.ts +11 -0
  238. package/src/theme/keys.ts +32 -0
  239. package/src/theme/readChartAnnotations.spec.ts +58 -0
  240. package/src/theme/readChartAnnotations.ts +69 -0
  241. package/src/theme/resolveTheme.spec.ts +160 -0
  242. package/src/theme/resolveTheme.ts +121 -0
  243. package/src/theme/types.ts +79 -0
  244. package/src/utils/dataAppEmbed.spec.ts +63 -0
  245. package/src/utils/dataAppEmbed.ts +84 -0
  246. package/src/utils/formatting.spec.ts +25 -21
  247. package/src/utils/formatting.ts +11 -7
  248. package/src/utils/malloyString.spec.ts +24 -0
  249. package/src/utils/malloyString.ts +12 -0
  250. package/src/utils/parsing.spec.ts +26 -19
  251. package/src/utils/parsing.ts +11 -6
  252. package/src/utils/queryClient.ts +17 -0
  253. package/test/README.md +185 -0
  254. package/test/serverProvider.tsx +72 -0
  255. package/test/setup.ts +29 -0
  256. package/tsconfig.json +12 -1
  257. package/tsconfig.spec.json +22 -0
  258. package/vite.config.ts +3 -0
  259. package/dist/ServerProvider-lOQXDlqB.cjs.js +0 -1
  260. package/dist/ServerProvider-on-8FH5Z.es.js +0 -3060
  261. package/dist/components/Home/AddProjectDialog.d.ts +0 -1
  262. package/dist/components/Home/DeleteProjectDialog.d.ts +0 -5
  263. package/dist/components/Home/EditProjectDialog.d.ts +0 -7
  264. package/dist/components/Package/Config.d.ts +0 -5
  265. package/dist/components/Package/Databases.d.ts +0 -5
  266. package/dist/components/Package/Notebooks.d.ts +0 -6
  267. package/dist/components/Project/Project.d.ts +0 -6
  268. package/dist/components/Project/index.d.ts +0 -2
  269. package/dist/index-BOLBP6_i.cjs.js +0 -233
  270. package/src/components/Package/Config.tsx +0 -97
  271. package/src/components/Package/Connections.tsx +0 -373
  272. package/src/components/Package/Databases.tsx +0 -228
  273. package/src/components/Package/Notebooks.tsx +0 -77
  274. package/src/components/Project/AddPackageDialog.tsx +0 -159
  275. package/src/components/Project/Packages.tsx +0 -191
  276. package/src/components/Project/Project.tsx +0 -52
  277. package/src/components/Project/index.ts +0 -2
  278. /package/dist/components/{Project → Environment}/About.d.ts +0 -0
  279. /package/dist/components/{Project → Environment}/AddPackageDialog.d.ts +0 -0
  280. /package/dist/components/{Project → Environment}/ConnectionExplorer.d.ts +0 -0
  281. /package/dist/components/{Package → Environment}/Connections.d.ts +0 -0
  282. /package/dist/components/{Project → Environment}/DeletePackageDialog.d.ts +0 -0
  283. /package/dist/components/{Project → Environment}/EditPackageDialog.d.ts +0 -0
  284. /package/dist/components/{Project → Environment}/Packages.d.ts +0 -0
package/README.md CHANGED
@@ -1,3 +1,8 @@
1
+ <!--
2
+ Copyright (c) Credible Data Inc.
3
+ SPDX-License-Identifier: MIT
4
+ -->
5
+
1
6
  # Malloy Publisher SDK
2
7
 
3
8
  The Publisher SDK (`@malloy-publisher/sdk`) is a comprehensive React component library for building data applications that interact with Publisher's REST API. It provides everything you need to browse semantic models, execute queries, visualize results, and build interactive data experiences.
@@ -46,7 +51,7 @@ import "@malloy-publisher/sdk/styles.css";
46
51
  function App() {
47
52
  return (
48
53
  <ServerProvider baseURL="http://localhost:4000/api/v0">
49
- <Home onClickProject={(path) => console.log("Navigate to:", path)} />
54
+ <Home onClickEnvironment={(path) => console.log("Navigate to:", path)} />
50
55
  </ServerProvider>
51
56
  );
52
57
  }
@@ -65,7 +70,7 @@ import {
65
70
  import {
66
71
  ServerProvider,
67
72
  Home,
68
- Project,
73
+ Environment,
69
74
  Package,
70
75
  Model,
71
76
  Notebook,
@@ -80,13 +85,13 @@ function App() {
80
85
  <BrowserRouter>
81
86
  <Routes>
82
87
  <Route path="/" element={<HomePage />} />
83
- <Route path="/:projectName" element={<ProjectPage />} />
88
+ <Route path="/:environmentName" element={<EnvironmentPage />} />
84
89
  <Route
85
- path="/:projectName/:packageName"
90
+ path="/:environmentName/:packageName"
86
91
  element={<PackagePage />}
87
92
  />
88
93
  <Route
89
- path="/:projectName/:packageName/*"
94
+ path="/:environmentName/:packageName/*"
90
95
  element={<ModelPage />}
91
96
  />
92
97
  </Routes>
@@ -97,20 +102,20 @@ function App() {
97
102
 
98
103
  function HomePage() {
99
104
  const navigate = useRouterClickHandler();
100
- return <Home onClickProject={navigate} />;
105
+ return <Home onClickEnvironment={navigate} />;
101
106
  }
102
107
 
103
- function ProjectPage() {
108
+ function EnvironmentPage() {
104
109
  const navigate = useRouterClickHandler();
105
- const { projectName } = useParams();
106
- const resourceUri = encodeResourceUri({ projectName });
107
- return <Project onSelectPackage={navigate} resourceUri={resourceUri} />;
110
+ const { environmentName } = useParams();
111
+ const resourceUri = encodeResourceUri({ environmentName });
112
+ return <Environment onSelectPackage={navigate} resourceUri={resourceUri} />;
108
113
  }
109
114
 
110
115
  function PackagePage() {
111
116
  const navigate = useRouterClickHandler();
112
- const { projectName, packageName } = useParams();
113
- const resourceUri = encodeResourceUri({ projectName, packageName });
117
+ const { environmentName, packageName } = useParams();
118
+ const resourceUri = encodeResourceUri({ environmentName, packageName });
114
119
  return <Package onClickPackageFile={navigate} resourceUri={resourceUri} />;
115
120
  }
116
121
 
@@ -118,7 +123,7 @@ function ModelPage() {
118
123
  const params = useParams();
119
124
  const modelPath = params["*"];
120
125
  const resourceUri = encodeResourceUri({
121
- projectName: params.projectName,
126
+ environmentName: params.environmentName,
122
127
  packageName: params.packageName,
123
128
  modelPath,
124
129
  });
@@ -142,14 +147,14 @@ function ModelPage() {
142
147
  The SDK uses a standardized URI format to identify resources:
143
148
 
144
149
  ```
145
- publisher://projects/{projectName}/packages/{packageName}/models/{modelPath}?versionId={version}
150
+ publisher://environments/{environmentName}/packages/{packageName}/models/{modelPath}?versionId={version}
146
151
  ```
147
152
 
148
153
  Examples:
149
154
 
150
- - Project: `publisher://projects/my-project`
151
- - Package: `publisher://projects/my-project/packages/analytics`
152
- - Model: `publisher://projects/my-project/packages/analytics/models/orders.malloy`
155
+ - Environment: `publisher://environments/my-environment`
156
+ - Package: `publisher://environments/my-environment/packages/analytics`
157
+ - Model: `publisher://environments/my-environment/packages/analytics/models/orders.malloy`
153
158
 
154
159
  Use the `encodeResourceUri()` and `parseResourceUri()` utilities to work with these URIs.
155
160
 
@@ -159,8 +164,8 @@ The SDK components follow a natural hierarchy:
159
164
 
160
165
  ```
161
166
  ServerProvider (required wrapper)
162
- ├── Home (list all projects)
163
- │ └── Project (show packages in a project)
167
+ ├── Home (list all environments)
168
+ │ └── Environment (show packages in an environment)
164
169
  │ └── Package (show models, notebooks, connections)
165
170
  │ ├── Model (visual query builder + named queries)
166
171
  │ └── Notebook (read-only notebook viewer)
@@ -174,13 +179,13 @@ Components accept callback functions for navigation rather than handling routing
174
179
  ```tsx
175
180
  // With React Router
176
181
  const navigate = useRouterClickHandler();
177
- <Home onClickProject={navigate} />
182
+ <Home onClickEnvironment={navigate} />
178
183
 
179
184
  // Custom navigation
180
- <Home onClickProject={(path) => window.location.href = path} />
185
+ <Home onClickEnvironment={(path) => window.location.href = path} />
181
186
 
182
187
  // SPA with history
183
- <Home onClickProject={(path) => history.push(path)} />
188
+ <Home onClickEnvironment={(path) => history.push(path)} />
184
189
  ```
185
190
 
186
191
  ---
@@ -195,7 +200,7 @@ The `ServerProvider` is the required context provider that wraps your applicatio
195
200
  | ---------------- | ----------------------- | ------------- | -------------------------------------------------------------------- |
196
201
  | `baseURL` | `string` | Auto-detected | Base URL of the Publisher API (e.g., `http://localhost:4000/api/v0`) |
197
202
  | `getAccessToken` | `() => Promise<string>` | `undefined` | Async function returning auth token |
198
- | `mutable` | `boolean` | `true` | Enable/disable project/package management UI |
203
+ | `mutable` | `boolean` | `true` | Enable/disable environment/package management UI |
199
204
 
200
205
  ### Basic Usage
201
206
 
@@ -238,19 +243,19 @@ async function getAccessToken() {
238
243
 
239
244
  ### Home
240
245
 
241
- Displays a landing page with feature cards and a list of all available projects.
246
+ Displays a landing page with feature cards and a list of all available environments.
242
247
 
243
248
  ```tsx
244
249
  import { Home } from "@malloy-publisher/sdk";
245
250
 
246
251
  interface HomeProps {
247
- onClickProject?: (path: string, event?: React.MouseEvent) => void;
252
+ onClickEnvironment?: (path: string, event?: React.MouseEvent) => void;
248
253
  }
249
254
 
250
255
  // Usage
251
256
  <Home
252
- onClickProject={(path, event) => {
253
- // path is like "/my-project/"
257
+ onClickEnvironment={(path, event) => {
258
+ // path is like "/my-environment/"
254
259
  navigate(path);
255
260
  }}
256
261
  />;
@@ -260,27 +265,27 @@ interface HomeProps {
260
265
 
261
266
  - Hero section with Publisher branding
262
267
  - Feature cards (Ad Hoc Analysis, Notebook Dashboards, AI Agents)
263
- - Project listing with descriptions
264
- - Add/Edit/Delete project dialogs (when `mutable=true`)
268
+ - Environment listing with descriptions
269
+ - Add/Edit/Delete environment dialogs (when `mutable=true`)
265
270
 
266
271
  ---
267
272
 
268
- ### Project
273
+ ### Environment
269
274
 
270
- Shows all packages within a project.
275
+ Shows all packages within an environment.
271
276
 
272
277
  ```tsx
273
- import { Project, encodeResourceUri } from "@malloy-publisher/sdk";
278
+ import { Environment, encodeResourceUri } from "@malloy-publisher/sdk";
274
279
 
275
- interface ProjectProps {
280
+ interface EnvironmentProps {
276
281
  onSelectPackage: (path: string, event?: React.MouseEvent) => void;
277
282
  resourceUri: string;
278
283
  }
279
284
 
280
285
  // Usage
281
- const resourceUri = encodeResourceUri({ projectName: "my-project" });
286
+ const resourceUri = encodeResourceUri({ environmentName: "my-environment" });
282
287
 
283
- <Project
288
+ <Environment
284
289
  onSelectPackage={(path) => navigate(path)}
285
290
  resourceUri={resourceUri}
286
291
  />;
@@ -290,7 +295,7 @@ const resourceUri = encodeResourceUri({ projectName: "my-project" });
290
295
 
291
296
  - Package listing with version info
292
297
  - Add/Edit/Delete package dialogs (when `mutable=true`)
293
- - Project README display
298
+ - Environment README display
294
299
 
295
300
  ---
296
301
 
@@ -308,7 +313,7 @@ interface PackageProps {
308
313
 
309
314
  // Usage
310
315
  const resourceUri = encodeResourceUri({
311
- projectName: "my-project",
316
+ environmentName: "my-environment",
312
317
  packageName: "analytics",
313
318
  });
314
319
 
@@ -322,7 +327,7 @@ const resourceUri = encodeResourceUri({
322
327
 
323
328
  - Models list (`.malloy` files)
324
329
  - Notebooks list (`.malloynb` files)
325
- - Embedded databases (`.parquet` files)
330
+ - Embedded databases (`.parquet`, `.csv`, and `.xlsx` files)
326
331
  - Connection configuration
327
332
  - Package README
328
333
 
@@ -350,7 +355,7 @@ interface QueryExplorerResult {
350
355
 
351
356
  // Usage
352
357
  const resourceUri = encodeResourceUri({
353
- projectName: "my-project",
358
+ environmentName: "my-environment",
354
359
  packageName: "analytics",
355
360
  modelPath: "models/orders.malloy",
356
361
  });
@@ -424,11 +429,24 @@ import { Notebook, encodeResourceUri } from "@malloy-publisher/sdk";
424
429
  interface NotebookProps {
425
430
  resourceUri: string;
426
431
  maxResultSize?: number; // Default: 0 (no limit)
432
+ // The notebook's `given:` parameters. Pass the ones you hold (from the URL,
433
+ // say) and the notebook runs every cell with them.
434
+ givens?: Record<string, string>;
435
+ // Called when a parameter changes, with the new values and the names the
436
+ // notebook manages, so a host can put them in the URL. `managed` is what to
437
+ // clear when a value goes away; anything else in your URL is left alone.
438
+ onGivensChange?: (
439
+ givens: Record<string, string>,
440
+ managed: readonly string[],
441
+ ) => void;
442
+ // Where a `# drill` click wants to go. Given no handler, a drill onto the
443
+ // notebook's own parameters still works; only navigation away is dropped.
444
+ onNavigate?: (to: string, event?: NavigationClick) => void;
427
445
  }
428
446
 
429
447
  // Usage
430
448
  const resourceUri = encodeResourceUri({
431
- projectName: "my-project",
449
+ environmentName: "my-environment",
432
450
  packageName: "analytics",
433
451
  modelPath: "notebooks/sales-dashboard.malloynb",
434
452
  });
@@ -465,7 +483,7 @@ interface WorkbookProps {
465
483
  // Usage
466
484
  const workbookStorage = new BrowserWorkbookStorage();
467
485
  const resourceUri = encodeResourceUri({
468
- projectName: "my-project",
486
+ environmentName: "my-environment",
469
487
  packageName: "analytics",
470
488
  });
471
489
 
@@ -508,7 +526,7 @@ interface QueryResultProps {
508
526
  sourceName="orders"
509
527
  queryName="by_region"
510
528
  resourceUri={encodeResourceUri({
511
- projectName: "my-project",
529
+ environmentName: "my-environment",
512
530
  packageName: "analytics",
513
531
  modelPath: "models/orders.malloy",
514
532
  })}
@@ -518,7 +536,7 @@ interface QueryResultProps {
518
536
  <QueryResult
519
537
  query="run: orders -> { group_by: status; aggregate: order_count }"
520
538
  resourceUri={encodeResourceUri({
521
- projectName: "my-project",
539
+ environmentName: "my-environment",
522
540
  packageName: "analytics",
523
541
  modelPath: "models/orders.malloy",
524
542
  })}
@@ -538,14 +556,19 @@ interface RenderedResultProps {
538
556
  result: string; // JSON result string
539
557
  height?: number; // Fixed height in pixels
540
558
  onSizeChange?: (height: number) => void; // Callback when size changes
541
- onDrill?: (element: unknown) => void; // Drill-down callback
559
+ drill?: DrillBinding; // `# drill` click handling and its affordance
542
560
  }
543
561
 
544
562
  // Usage (result is the JSON string from query execution)
545
563
  <RenderedResult
546
564
  result={queryResultJson}
547
- onDrill={(element) => {
548
- console.log("Drilled into:", element);
565
+ drill={{
566
+ onClick: (payload) => {
567
+ console.log("Clicked:", payload.field?.name, payload.value);
568
+ },
569
+ // Which fields' cells should read as clickable. Build the whole binding
570
+ // with `useDrill` to get destination handling and the menu for free.
571
+ canDrill: () => false,
549
572
  }}
550
573
  />;
551
574
  ```
@@ -567,7 +590,7 @@ const embedded = createEmbeddedQueryResult({
567
590
  queryName: "by_region",
568
591
  sourceName: "orders",
569
592
  resourceUri: encodeResourceUri({
570
- projectName: "my-project",
593
+ environmentName: "my-environment",
571
594
  packageName: "analytics",
572
595
  modelPath: "models/orders.malloy",
573
596
  }),
@@ -581,7 +604,9 @@ const embedded = createEmbeddedQueryResult({
581
604
 
582
605
  ## Dimensional Filters
583
606
 
584
- The SDK supports interactive dimensional filtering for notebooks and embedded data apps. Filters are configured through annotations in Malloy source files and notebooks.
607
+ The SDK supports interactive dimensional filtering for hand-built data apps.
608
+ Filters are configured through annotations in Malloy source files. The `Notebook`
609
+ component does not use this mechanism; see [Notebooks use `given:`](#notebooks-use-given-not-these-annotations) below.
585
610
 
586
611
  ### Filter Types
587
612
 
@@ -657,21 +682,16 @@ source: recalls is duckdb.table('data/recalls.csv') extend {
657
682
 
658
683
  The `# label="..."` annotation can be placed before or after the `#(filter)` annotation. When present, the label value will be displayed in the filter UI instead of the raw field name.
659
684
 
660
- ### Notebook Annotation Syntax
661
-
662
- Enable filters in a notebook by adding a `##(filters)` annotation in a Malloy code cell. This annotation specifies which dimensions should appear as filters using `source.dimension` format:
663
-
664
- **Simple array format:**
665
- ```malloy
666
- ##(filters) ["flights.origin_code", "carriers.name", "flights.flight_departure"]
667
- import {flights, carriers} from 'flights.malloy'
668
- ```
685
+ ### Notebooks use `given:`, not these annotations
669
686
 
670
- The filter type for each dimension is determined by the `#(filter)` annotation on that dimension in the source file. If no source annotation exists, the dimension is ignored.
687
+ The `Notebook` component no longer renders a filter panel from a `##(filters)`
688
+ annotation, and its `retrievalFn` prop is gone with it. A notebook's controls now
689
+ come from the `given:` parameters its model declares, which is the mechanism
690
+ described in [docs/givens.md](../../docs/givens.md). A `##(filters)` annotation in
691
+ a notebook cell is inert.
671
692
 
672
- **Note**: Semantic search is not supported by the Publisher.
673
- When using the Notebook component, you supply an async function which implements the search for that column+query.
674
- If no search function is supplied, the filter is ignored.
693
+ The `#(filter)` source annotations above still work, and so do the hooks below.
694
+ They are what a hand-built data app uses; only the notebook's own panel changed.
675
695
 
676
696
  ### React Hooks for Programmatic Filtering
677
697
 
@@ -684,7 +704,7 @@ import {
684
704
  } from '@malloy-publisher/sdk';
685
705
 
686
706
  const config: DimensionFiltersConfig = {
687
- project: "malloy-samples",
707
+ environment: "malloy-samples",
688
708
  package: "faa",
689
709
  indexLimit: 1000,
690
710
  dimensionSpecs: [
@@ -743,9 +763,9 @@ function MyComponent() {
743
763
  } = useServer();
744
764
 
745
765
  // Use API clients directly
746
- const projects = await apiClients.projects.listProjects();
766
+ const environments = await apiClients.environments.listEnvironments();
747
767
  const model = await apiClients.models.getModel(
748
- projectName,
768
+ environmentName,
749
769
  packageName,
750
770
  modelPath,
751
771
  versionId,
@@ -758,7 +778,7 @@ function MyComponent() {
758
778
  ```typescript
759
779
  interface ApiClients {
760
780
  models: ModelsApi; // Get/execute models
761
- projects: ProjectsApi; // CRUD projects
781
+ environments: EnvironmentsApi; // CRUD environments
762
782
  packages: PackagesApi; // CRUD packages
763
783
  notebooks: NotebooksApi; // Get/execute notebooks
764
784
  connections: ConnectionsApi; // CRUD connections
@@ -780,7 +800,7 @@ function MyComponent() {
780
800
  const { data, isLoading, isError, error } = useQueryWithApiError({
781
801
  queryKey: ["my-data", someParam],
782
802
  queryFn: async () => {
783
- const response = await apiClients.projects.listProjects();
803
+ const response = await apiClients.environments.listEnvironments();
784
804
  return response.data;
785
805
  },
786
806
  });
@@ -808,18 +828,18 @@ import { useMutationWithApiError } from "@malloy-publisher/sdk";
808
828
 
809
829
  function MyComponent() {
810
830
  const mutation = useMutationWithApiError({
811
- mutationFn: async (newProject) => {
812
- const response = await apiClients.projects.createProject(newProject);
831
+ mutationFn: async (newEnvironment) => {
832
+ const response = await apiClients.environments.createEnvironment(newEnvironment);
813
833
  return response.data;
814
834
  },
815
835
  onSuccess: () => {
816
- queryClient.invalidateQueries(["projects"]);
836
+ queryClient.invalidateQueries(["environments"]);
817
837
  },
818
838
  });
819
839
 
820
840
  return (
821
- <button onClick={() => mutation.mutate({ name: "new-project" })}>
822
- Create Project
841
+ <button onClick={() => mutation.mutate({ name: "new-environment" })}>
842
+ Create Environment
823
843
  </button>
824
844
  );
825
845
  }
@@ -897,7 +917,7 @@ function MyComponent() {
897
917
  const navigate = useRouterClickHandler();
898
918
 
899
919
  return (
900
- <button onClick={(e) => navigate("/projects/analytics", e)}>
920
+ <button onClick={(e) => navigate("/environments/analytics", e)}>
901
921
  Go to Analytics
902
922
  </button>
903
923
  );
@@ -922,27 +942,27 @@ Create a resource URI from components.
922
942
  ```tsx
923
943
  import { encodeResourceUri } from "@malloy-publisher/sdk";
924
944
 
925
- // Project only
926
- const projectUri = encodeResourceUri({
927
- projectName: "my-project",
945
+ // Environment only
946
+ const environmentUri = encodeResourceUri({
947
+ environmentName: "my-environment",
928
948
  });
929
- // Result: "publisher://projects/my-project"
949
+ // Result: "publisher://environments/my-environment"
930
950
 
931
951
  // Package
932
952
  const packageUri = encodeResourceUri({
933
- projectName: "my-project",
953
+ environmentName: "my-environment",
934
954
  packageName: "analytics",
935
955
  });
936
- // Result: "publisher://projects/my-project/packages/analytics"
956
+ // Result: "publisher://environments/my-environment/packages/analytics"
937
957
 
938
958
  // Model with version
939
959
  const modelUri = encodeResourceUri({
940
- projectName: "my-project",
960
+ environmentName: "my-environment",
941
961
  packageName: "analytics",
942
962
  modelPath: "models/orders.malloy",
943
963
  versionId: "abc123",
944
964
  });
945
- // Result: "publisher://projects/my-project/packages/analytics/models/models/orders.malloy?versionId=abc123"
965
+ // Result: "publisher://environments/my-environment/packages/analytics/models/models/orders.malloy?versionId=abc123"
946
966
  ```
947
967
 
948
968
  ---
@@ -955,12 +975,12 @@ Parse a resource URI back to components.
955
975
  import { parseResourceUri } from "@malloy-publisher/sdk";
956
976
 
957
977
  const uri =
958
- "publisher://projects/my-project/packages/analytics/models/orders.malloy?versionId=abc123";
978
+ "publisher://environments/my-environment/packages/analytics/models/orders.malloy?versionId=abc123";
959
979
  const parsed = parseResourceUri(uri);
960
980
 
961
981
  // Result:
962
982
  // {
963
- // projectName: "my-project",
983
+ // environmentName: "my-environment",
964
984
  // packageName: "analytics",
965
985
  // modelPath: "orders.malloy",
966
986
  // versionId: "abc123"
@@ -973,7 +993,7 @@ const parsed = parseResourceUri(uri);
973
993
 
974
994
  ```typescript
975
995
  type ParsedResource = {
976
- projectName: string;
996
+ environmentName: string;
977
997
  packageName?: string;
978
998
  connectionName?: string;
979
999
  versionId?: string;
@@ -1219,7 +1239,7 @@ import { Grid, Typography, Paper } from "@mui/material";
1219
1239
 
1220
1240
  function Dashboard() {
1221
1241
  const resourceUri = encodeResourceUri({
1222
- projectName: "my-project",
1242
+ environmentName: "my-environment",
1223
1243
  packageName: "analytics",
1224
1244
  modelPath: "models/sales.malloy",
1225
1245
  });
@@ -1300,7 +1320,7 @@ import { DataGrid } from "@mui/x-data-grid";
1300
1320
 
1301
1321
  function DataTable() {
1302
1322
  const resourceUri = encodeResourceUri({
1303
- projectName: "my-project",
1323
+ environmentName: "my-environment",
1304
1324
  packageName: "analytics",
1305
1325
  modelPath: "models/customers.malloy",
1306
1326
  });
@@ -1353,7 +1373,7 @@ function Explorer() {
1353
1373
  const [selectedQuery, setSelectedQuery] = useState(null);
1354
1374
 
1355
1375
  const resourceUri = encodeResourceUri({
1356
- projectName: "my-project",
1376
+ environmentName: "my-environment",
1357
1377
  packageName: "analytics",
1358
1378
  modelPath: "models/orders.malloy",
1359
1379
  });
@@ -1395,24 +1415,24 @@ import { ServerProvider, useServer } from "@malloy-publisher/sdk/client";
1395
1415
  function MyApp() {
1396
1416
  return (
1397
1417
  <ServerProvider baseURL="http://localhost:4000/api/v0">
1398
- <ProjectList />
1418
+ <EnvironmentList />
1399
1419
  </ServerProvider>
1400
1420
  );
1401
1421
  }
1402
1422
 
1403
- function ProjectList() {
1423
+ function EnvironmentList() {
1404
1424
  const { apiClients } = useServer();
1405
- const [projects, setProjects] = useState([]);
1425
+ const [environments, setEnvironments] = useState([]);
1406
1426
 
1407
1427
  useEffect(() => {
1408
- apiClients.projects
1409
- .listProjects()
1410
- .then((response) => setProjects(response.data));
1428
+ apiClients.environments
1429
+ .listEnvironments()
1430
+ .then((response) => setEnvironments(response.data));
1411
1431
  }, []);
1412
1432
 
1413
1433
  return (
1414
1434
  <ul>
1415
- {projects.map((p) => (
1435
+ {environments.map((p) => (
1416
1436
  <li key={p.name}>{p.name}</li>
1417
1437
  ))}
1418
1438
  </ul>
@@ -1429,8 +1449,8 @@ function ProjectList() {
1429
1449
  | Component | Description |
1430
1450
  | ------------------------- | ----------------------------------------------- |
1431
1451
  | `ServerProvider` | Required context provider for API access |
1432
- | `Home` | Project listing landing page |
1433
- | `Project` | Package listing for a project |
1452
+ | `Home` | Environment listing landing page |
1453
+ | `Environment` | Package listing for an environment |
1434
1454
  | `Package` | Package detail (models, notebooks, connections) |
1435
1455
  | `Model` | Full model explorer with visual query builder |
1436
1456
  | `ModelExplorer` | Lower-level query builder component |
package/TREE_SHAKING.md CHANGED
@@ -1,3 +1,8 @@
1
+ <!--
2
+ Copyright (c) Credible Data Inc.
3
+ SPDX-License-Identifier: MIT
4
+ -->
5
+
1
6
  # SDK Tree-Shaking and Code Splitting Guide
2
7
 
3
8
  This document explains how to use the Malloy Publisher SDK's optimized packaging for better tree-shaking and code splitting.
@@ -29,7 +34,7 @@ function YourComponent() {
29
34
  const { apiClients } = useServer();
30
35
 
31
36
  // Use API clients for data fetching
32
- const projects = await apiClients.projects.getProjects();
37
+ const environments = await apiClients.environments.listEnvironments();
33
38
 
34
39
  return <div>{/* Your custom UI */}</div>;
35
40
  }
@@ -52,7 +57,7 @@ The client entry point (`@malloy-publisher/sdk/client`) is ideal when you:
52
57
  The client entry exports:
53
58
  - `ServerProvider` and `useServer` React components
54
59
  - `globalQueryClient` for direct React Query access
55
- - All OpenAPI-generated client APIs (`ConnectionsApi`, `ProjectsApi`, etc.)
60
+ - All OpenAPI-generated client APIs (`ConnectionsApi`, `EnvironmentsApi`, etc.)
56
61
  - `Configuration` class for API client setup
57
62
 
58
63
  ## Full SDK Usage
@@ -65,7 +70,7 @@ import {
65
70
  ServerProvider,
66
71
  useServer,
67
72
  Home,
68
- Project,
73
+ Environment,
69
74
  Package,
70
75
  Model,
71
76
  Notebook
@@ -89,7 +94,7 @@ import {
89
94
  ServerProvider,
90
95
  useServer,
91
96
  Configuration,
92
- ProjectsApi,
97
+ EnvironmentsApi,
93
98
  ConnectionsApi
94
99
  } from '@malloy-publisher/sdk/client';
95
100
 
@@ -98,15 +103,15 @@ const config = new Configuration({
98
103
  basePath: 'https://your-publisher-instance.com'
99
104
  });
100
105
 
101
- const projectsApi = new ProjectsApi(config);
106
+ const environmentsApi = new EnvironmentsApi(config);
102
107
 
103
108
  function MyComponent() {
104
109
  const { apiClients } = useServer();
105
110
 
106
111
  // Use either the context clients or direct instances
107
- const projects = await apiClients.projects.getProjects();
112
+ const environments = await apiClients.environments.listEnvironments();
108
113
  // OR
109
- const projects2 = await projectsApi.getProjects();
114
+ const environments2 = await environmentsApi.listEnvironments();
110
115
 
111
116
  return <div>{/* Your UI */}</div>;
112
117
  }
@@ -117,17 +122,17 @@ function MyComponent() {
117
122
  ```tsx
118
123
  // ✅ Types-only import - zero bundle impact
119
124
  import type {
120
- ProjectsApi,
125
+ EnvironmentsApi,
121
126
  ModelsApi,
122
127
  QueryResult
123
128
  } from '@malloy-publisher/sdk/client';
124
129
 
125
130
  // Your API wrapper
126
131
  class MyApiWrapper {
127
- constructor(private projectsApi: ProjectsApi) {}
132
+ constructor(private environmentsApi: EnvironmentsApi) {}
128
133
 
129
- async getProject(id: string): Promise<QueryResult> {
130
- return this.projectsApi.getProject(id);
134
+ async getEnvironment(name: string): Promise<QueryResult> {
135
+ return this.environmentsApi.getEnvironment(name);
131
136
  }
132
137
  }
133
138
  ```
package/bunfig.toml ADDED
@@ -0,0 +1,7 @@
1
+ # Copyright (c) Credible Data Inc.
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ [test]
5
+ # Installs a DOM onto globalThis before any spec runs, so React components and
6
+ # hooks in this package can be rendered under `bun test`. See test/setup.ts.
7
+ preload = ["./test/setup.ts"]